﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="../Content/scripts/jquery-1.11.1.min.js"></script>
    <script src="../Content/scripts/bootstrap/bootstrap.min.js"></script>
    <link href="../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jquery-ui/jquery-ui.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
    <link href="../Content/styles/font-awesome.min.css" rel="stylesheet" />
    <link href="../Content/adminLTE/css/index.css" rel="stylesheet" />
    <link href="../Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
   
    <link rel="Shortcut icon" href="../images/favicon.ico" />
    <link href="../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../Content/scripts/plugins/dialog/dialog.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <script src="../Content/scripts/plugins/validator/validator.js"></script>
    <script src="../Content/scripts/utils/learun-ui.js"></script>
    <script src="../Content/scripts/utils/learun-form.js"></script>
    <script src="../My97DatePicker/WdatePicker.js"></script>
    <script src="../js/jQuery.upload.min.js"></script>
    <script src="../js/uploadvideo.js"></script>
    <link href="upload.css" rel="stylesheet" />
    <script src="ProblemJS.js"></script>

    <style>
        html, body {
            height: 100%;
            width: 100%;
        }

        .form .form-control {
            width: 200px;
        }
        .case{margin-top: 15px;width:600px;}
    </style>
</head>
<body>
    <div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
        <table class="form" id="problemadd" style="margin-top:10px;">
            <tr>
                <th class="formTitle">厂商名称<font face="宋体">*</font></th>
                <td class="formValue">
                  
                    <select id="CustomerID" class="form-control" placeholder="请选择厂商名称" isvalid="yes" checkexpession="NotNull"></select>
                </td>
            </tr>
            
            <tr>
                <th class="formTitle">联系人<font face="宋体">*</font></th>
                <td class="formValue">
                    <select id="ToUserNo" class="form-control" placeholder="请选择联系人" isvalid="yes" checkexpession="NotNull"></select>
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 4px;">
                    问题描述<font face="宋体">*</font>
                </th>
                <td class="formValue" colspan="2">
                    <textarea id="ProblemIssue" class="form-control" style="height: 100px; margin-top: 15px; width: 600px;" isvalid="yes" checkexpession="NotNull"></textarea>
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 4px;">
                    上传图片
                </th>
                <td class="formValue" colspan="2">
                    <div class="case">
                        <div class="upload" action='ProblemInfo.ashx?Action=uploadimg' method="post" enctype="multipart/form-data" id='case1' data-value=""></div>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 4px;">
                    上传视频
                </th>
                <td class="formValue">
                    <input type="text" class="form-control" id="VideoPath"  readonly />
                </td>
                <td class="formValue">
                    <input id="file" type="file" name="file" accept=".mp4">
                </td>
                <td class="formValue">

                    <a id="btn_upload" class="btn btn-default" onclick="onUpload(event)" style="height:26px; padding-top:2px"><i class="fa fa-upload"></i>&nbsp;上传</a>
                </td>
            </tr>
        </table>
    </div>

    <script>
    $(function () {
        $("#case1").upload();
        //$("#CustomerName").val(getCookie("CustomerName"));
        var CustomerID = getCookie("CustomerID");
        if (CustomerID != "") {
            $("#CustomerID").html("<option value='0'>宏大</option>");
            $.probleminfojs.getToUserNoByCustomerID("");
        }
        else {
            $.probleminfojs.getCustomerListByHongDa();
        }
        // $.probleminfojs.getEquNoListByCustomerID(getCookie("CustomerID"));
        $("#CustomerID").on('change', function () {
            //判断是否选取prompt属性，无返回值；
            if ($(this).val()) {
                var selectText = $(this).find('option:selected').text();
                $.probleminfojs.getToUserNoByCustomerID(selectText);
            } 
        });

    })


    function onUpload(event) {
        $.probleminfojs.uploadvideo();
        //$.customerinfojs.uploadimage();
    }

    // 保存表单  
    function AcceptClick(grid) {
        
        if (!$('#problemadd').Validform()) {
            return false;
        }

        var CustomerName = $('#CustomerID').val();
        var FromUserNo = getCookie("userno");
        var ToUserNo = $('#ToUserNo').val();
        var ProblemIssue = $('#ProblemIssue').val();
        var VideoPath = $('#VideoPath').val();
        var ProblemImage = $("input[name='upload']").val();
        
        $.probleminfojs.saveProblemInfo(CustomerName, FromUserNo,ToUserNo, ProblemIssue, ProblemImage, VideoPath, grid);
       
    }


    //读取cookie
    function getCookie(name) {
        var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
        if (arr != null) return decodeURI(arr[2]); return null;
    };

    </script>
  
</body>
</html>



